//    Copyright (C) Kherty.  All rights reserved.
using System.Diagnostics.Contracts;

namespace OpenLS.Spreadsheet
{
    sealed class WorksheetRangeManager
    {
        public void OnCellAdded (object sender, CellEventArgs args)
        {
            return;
            Cell cell = args.Cell;
            foreach (RangeNode node in _rangeNodes.Values)
            {
                if (node.Range.Contains(cell))
                    cell.AddDependent(node);
            }
        }

        readonly WeakDictionary<string, RangeNode> _rangeNodes = new WeakDictionary<string, RangeNode>();
        internal RangeNode GetNode(Range range)
        {
            Contract.Requires(range != null);
            RangeNode result;
            string label = range.Label;
            if (_rangeNodes.TryGetValue(label, out result))
                return result;
            result = new RangeNode(range);
            _rangeNodes.Add(label, result);
            return result;
            
        }
    }
}
